import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:x_common_utils/utils/inkWell_util.dart';
import 'package:get/get.dart';
import 'package:xinxuan/utils/color_util.dart';

class TransferDialog extends Dialog {

  final String nickname;
  final String phone;
  final Function onTap;
  TransferDialog({ required this.nickname, required this.phone, required this.onTap });

  @override
  Widget build(BuildContext context) {
    return Material(
      type: MaterialType.transparency,
      child: Center(
        child: Container(
          width: 320.w,
          decoration: BoxDecoration(
            color: bgWhiteColor,
            borderRadius: BorderRadius.circular(12.w)
          ),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              Container(
                padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 32.h),
                child: Column(
                  children: [
                    Text(
                      '接受人确认',
                      textAlign: TextAlign.center,
                      style: TextStyle(
                        color: textBlackColor,
                        fontSize: 20.sp
                      ),
                    ),
                    Container(
                      padding: EdgeInsets.only(top: 20.h),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            '接受人：',
                            style: TextStyle(
                              color: textBlackColor,
                              fontSize: 16.sp,
                            ),
                          ),
                          SizedBox(height: 6.h),
                          Container(
                            alignment: Alignment.centerLeft,
                            child: Text.rich(
                              TextSpan(
                                children: [
                                  TextSpan(
                                    text: '$nickname',
                                    style: TextStyle(
                                      color: textSubtitleColor,
                                      fontSize: 14.sp
                                    ),
                                  ),
                                  WidgetSpan(child: Container(width: 12.w)),
                                  TextSpan(
                                    text: '$phone',
                                    style: TextStyle(
                                      color: textSubtitleColor,
                                      fontSize: 14.sp
                                    ),
                                  ),
                                ]
                              )
                            ),
                          )
                        ],
                      )
                    )
                  ],
                ),
              ),
              Container(
                height: 55.h,
                decoration: BoxDecoration(
                  border: Border(
                    top: BorderSide(
                      width: .5,
                      color: lineColor
                    )
                  )
                ),
                child: Row(
                  children: [
                    InkWellUtil.shakeProofInkWell(Container(
                      width: 160.w,
                      height: 55.h,
                      alignment: Alignment.center,
                      decoration: BoxDecoration(
                        border: Border(
                          right: BorderSide(
                            width: .5,
                            color: lineColor
                          )
                        )
                      ),
                      child: Text(
                        '取消',
                        style: TextStyle(
                          fontSize: 16.sp,
                          color: textSubtitleColor
                        ),
                      ),
                    ), () async {
                      Get.back();
                    },
                    hoverColor: Colors.transparent,
                    splashColor: Colors.transparent,
                    highlightColor: Colors.transparent),
                    InkWellUtil.shakeProofInkWell(Container(
                      width: 159.w,
                      height: 55.h,
                      alignment: Alignment.center,
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.only(
                          bottomRight: Radius.circular(12.w),
                        )
                      ),
                      child: Text(
                        '确定',
                        style: TextStyle(
                          fontSize: 16.sp,
                          color: mainTextColor
                        ),
                      ),
                    ), () async {
                      Get.back();
                      onTap();
                    },
                    hoverColor: Colors.transparent,
                    splashColor: Colors.transparent,
                    highlightColor: Colors.transparent)
                  ],
                )
              )
            ],
          ),
        ),
      ),
    );
  }
}